package com.soxing.braindata.domain.stat;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Data
public class QAEntity implements Serializable {
    public static String name = "QA统计";
    public static String key = "QA_BAR";

    static String[] level = {"-1","0-10","10-20","20-30","30-40","40-50","50-60","60-70","70-80","80-90","90-100"};
    private Map<String,Long> stat;
    public QAEntity(List<Float> siteQA)
    {
        this.stat = siteQA.stream().collect(Collectors.groupingBy(
                x->{
                    if(x==-1)
                    {
                        return level[0];
                    }
                    else{
                        return level[(int)(x/10)+1];
                    }
                },Collectors.counting()
        ));

    }

}
